<template>
  <div class="search flex-start">
    <div class="date">
      <label for="">反馈日期</label
      > <el-date-picker
          v-model="adviseTime"
          type="date"
          :clearable="false"
          placeholder="请选择日期"
          :format="'yyyy-MM-dd HH:mm:ss'"

        >
        </el-date-picker>
    </div>
    <div class="type">
      <label for="">意见类型</label
      ><input class="searchInput" type="text" placeholder="请输入意见类型" v-model="adviseType" />
    </div>
    <div class="email">
      <label for="">邮箱</label
      ><input class="searchInput" type="text" placeholder="请输入邮箱" v-model="userPhone"/>
    </div>
    <div class="btnbox flex-start">
      <div class="btn-white2 cp" @click="reset">重置</div>
      <div class="btn-blue2 cp" @click="search">查询</div>
    </div>
  </div>
</template>

<script>
import Time from '@/utils/tools/getUTCTime'
export default {
  data () {
    return {
      adviseTime: this.$store.state.feedback.params.adviseTime,
      adviseType: this.$store.state.feedback.params.adviseType,
      userPhone: this.$store.state.feedback.params.userPhone
    }
  },
  methods: {
    search () {
      this.$store.commit('feedback/set_page', 1)
      this.$store.commit('feedback/set_size', 10)
      this.$store.commit('feedback/set_adviseTime', this.adviseTime ? Time.getTime(this.adviseTime) : null)
      this.$store.commit('feedback/set_adviseType', this.adviseType ? this.adviseType.trim() : null)
      this.$store.commit('feedback/set_userPhone', this.userPhone ? this.userPhone.trim() : null)
      this.$store.dispatch('feedback/getTableData').then(res => {
        // console.log(res.data)
      }).catch(err => {
        this.$message({
          type: 'error',
          message: err,
          duration: 1000
        })
      })
    },
    reset () {
      this.adviseTime = null
      this.adviseType = null
      this.userPhone = null
    }

  }
}
</script>

<style lang="scss" scoped>
.search {
  width: 100%;
  height: 80px;
  background-color: #fff;
  margin-top: 20px;
  position: relative;
  font-size: 14px;
  color: #3d4966;
  border-radius: 8px;
  div {
    label {
      margin-right: 12px;
    }
  }
  .date {
    margin-left: 36px;
  }
  .type {
    margin-left: 20px;
  }
  .email {
    margin-left: 20px;
  }
  .btnbox {
    height: 100%;

    position: absolute;
    right: 24px;
    .btn-white2 {
      margin-right: 20px;
    }
  }
}
</style>
